package file;

import java.io.File;
import java.util.Arrays;
import java.util.Comparator;

/**
 * @author ZhuQi
 * @ClassName Demo1
 * @Date 2022/10/17 14:56
 * @Version 1.0
 * @Description 通过FileFilter查询文件
 */
public class Demo1 {
    public static void main(String[] args) {
        String path = "D:\\需求文档";
        File file = new File(path);

        // 找到指定文件
//        File[] files = file.listFiles(File::isFile);
//        System.out.println(Arrays.toString(files));

        File[] files = file.listFiles();
        System.out.println(Arrays.toString(files));
        Arrays.sort(files, Comparator.comparingLong(File::getTotalSpace));
        System.out.println(Arrays.toString(files));

    }
}
